package com.yujs.tigao.controller;

import com.yujs.tigao.pojo.Brand;
import com.yujs.tigao.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/brand")
public class BrandController {
    @Autowired
    private BrandService brandService;

    @GetMapping(value = "/list")
    public String list(Model model){
        List<Brand> list = brandService.findAll();
        model.addAttribute("brands",list);
        return "index";

    }
}
